package main

import (
	"fmt"
	"gitlab.crc.com.cn/maxin70/ecsb-install/shell"
	"log"
)

func main() {
	fmt.Print("main \n")
	m := console.Machine{IP: "10.135.34.114", Port: 22, Username: "appuser", Password: "ECSB&openapi2023", Type: "password", KeyPath: "string"}
	fmt.Println(m)
	client := console.Login(&m)
	defer client.Close()

	//创建ssh-session
	session, err := client.NewSession()
	if err != nil {
		log.Fatal("创建ssh session 失败", err)
	}
	defer session.Close()
	//执行远程命令
	combo, err := session.CombinedOutput("ls -la /app")
	if err != nil {
		log.Fatal("远程执行cmd 失败", err)
	}
	log.Println("命令输出:", string(combo))
}
